server_name='aria2c'
server_port=6800
file_name=${0##*/}
self_count=`ps -ef | grep ${file_name} | grep -v grep | wc -l`
if [[ $self_count -gt 2 ]]
then
echo "others..."
exit
fi
ps -ef | grep -E '\s+'${server_name}'\s+' | grep -v grep 
if [[ $? -eq 1 ]]
then
  pc=`netstat -ntlp | grep ${server_port} | wc -l`
  if [[ $pc -lt 1 ]]
  then
    aria2c --conf-path=/etc/aria2/aria2.conf -D
  fi
fi
bt_list=`curl https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt | grep -v '^$' | sed ':x;N;s/\n/,/;tx'`
sudo sed -i 's@bt-tracker.*@bt-tracker='"${bt_list}"'@g' /etc/aria2/aria2.conf
